package com.intelligentmeterreadingsys.waterlist.querywaterlist.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.intelligentmeterreadingsys.R;
import com.intelligentmeterreadingsys.waterlist.db.WaterListDaoImpl;

/**
 * 相关数据统计
 * 
 * @author king
 * 
 */
public class SettingStatisticsInfoActivity extends Activity {

    public TextView textveiw1;// 用户总数

    public TextView textveiw2;// 水表总数
    public TextView textveiw3;// 未上传数
    public TextView textveiw4;// 未抄水表数

    public TextView textview5;// 报警水表数

    public TextView textview6;// 二次抄表数

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	System.out.println("onCreate");
	super.onCreate(savedInstanceState);
	setContentView(R.layout.settingstatisticsinfo);
	inti();

    }

    /**
     * 初始化组件
     */
    public void inti() {
	textveiw1 = (TextView) findViewById(R.id.totaluser);
	textveiw2 = (TextView) findViewById(R.id.totalwater);
	textveiw3 = (TextView) findViewById(R.id.statistics_noupload);
	textveiw4 = (TextView) findViewById(R.id.nocopywater);
	textview5 = (TextView) findViewById(R.id.totalalarmwater);
	textview6 = (TextView) findViewById(R.id.totalzerowater);
	WaterListDaoImpl dao = new WaterListDaoImpl(SettingStatisticsInfoActivity.this);

	textveiw1.setText(dao.queryAllUser() + "");
	textveiw2.setText(dao.queryAllWater() + "");
	textveiw3.setText("" + dao.queryNoUpload());
	textveiw4.setText(dao.queryAllNoRedWater() + "");
	textview5.setText(dao.queryAlarmWater() + "");
	textview6.setText(dao.queryTowCopy() + "");
	dao.close();

    }

    @Override
    protected void onResume() {
	inti();
	super.onResume();
    }

}
